class Solution {//leetcode2208——将数组和减半的最少操作次数
public:
    int halveArray(vector<int>& nums) {
        priority_queue<double> heap(nums.begin(),nums.end());
        double sum=0.0;
        for(auto e:nums){
            sum+=e;
        }
        sum/=2.0;
        int cnt=0;
        while(sum>0){
            double tmp=heap.top();
            heap.pop();
            sum-=tmp/2.0;
            tmp/=2.0;
            heap.push(tmp);
            cnt++;
        }
        return cnt;
    }
};